/**
 * Infrsound Driver.
 * Reads analogue infrsound signal from ADC12 and 
 * stores data if threshold is passed on SD card
 *
 * \file Infrasound.h
 * @author        Andreas Schlueter
 */


#ifndef INFRASOUND
#define INFRASOUND

#include "../../../../System/src/ScatterWeb.System.h"
#include "../../../../System/src/ScatterWeb.Data.h"

#define INFRA_SAMPLE_PERIOD 4      //i.e. 20Hz
#define INFRA_BUFFER_SIZE   1024
#define INFRA_BUFFER_MASK   1023    //for fast modulo
#define INFRA_SECTOR_SIZE   512     //size of block sent to sd card
//#define INFRA_SAMPLE_RATE         //uncomment this if samplerate to comm isn't needed

/* SD Card Peripheral clock rate, in Hz, used for timing. */
#define PERIPH_CLOCKRATE 8000000

/**
 * initialisation of ADC12
 *
 * @return true always
 */
bool Infrasound_init();


/**
 * data buffer
 */
UINT16 data[INFRA_BUFFER_SIZE];

/**
 * write pointer to data buffer
 */
static UINT16 writeIdx;

/**
 * read pointer to data buffer
 */
static UINT16 readIdx;


#endif
